<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/5/28
 * Time: 15:58
 */

namespace app\admin\controller;


use app\admin\logic\CityLogic;
use think\facade\Request;

class City extends Base
{

    private $cityLogic;

    public function __construct()
    {
        parent::__construct();
        $this->cityLogic = new CityLogic();
    }

    public function index(){
        return $this->fetch();
    }

    public function ajaxIndex(){
        $tempWhere = Request::post('');
        $list = $this->cityLogic->regionList($tempWhere, self::$nowPage);
        return json($list);
    }

    public function add(){
        $act = 'add';
        $id = Request::get('id');
        if ($id){
            $act = 'edit';
            $info = $this->cityLogic->regionInfo($id);
            $this->assign('info', $info['data']);
        }
        $this->assign('act', $act);
        return $this->fetch();
    }

    public function handle(){
        $data = Request::param('');
        $res = $this->cityLogic->handle($data);
        return json($res);
    }


}